package com.littledoctor.clinicassistant;

import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Auther: 周俊林
 * @Date: 2021/3/20
 * @Description:
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @org.springframework.context.annotation.Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
//                .paths(PathSelectors.any())
                .build().groupName("risk-system");
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("risk-system 接口定义和规范")
                .description("risk-system 接口定义和规范")
//                .termsOfServiceUrl("http://blog.didispace.com/")
//                .contact(new Contact("jjzhao@****.com", "", ""))
                .version("1.0")
                .license("版权所有 ©***信息科技有限公司")
//                .licenseUrl("")
                .build();
    }
}
